﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WarriorRush.GameDynamics.Utilities;
using Microsoft.Xna.Framework;

namespace WarriorRush.GameDynamics
{

    public class FrameState
    {
        public bool IsTapped;
        public Point TapPoint;
        public bool IsMainTargetChosen;
        public bool IsSecondaryTargetChosen;
        public bool IsDoneHit;
        public ArenaSquare CurrentSquare;

        public void Reset()
        {
            IsTapped = false;
            TapPoint = new Point();
            IsMainTargetChosen = false;
            IsSecondaryTargetChosen = false;
            IsDoneHit = false;
        }
    }

    public class BattleState
    {
        public Player CurrentPlayer;
        public CharacterClass Rusher;
        public CharacterClass RushTarget;
        public SelectionType CurrentSelection;
        public ArenaSquare CurrentSquare;
        public Phases CurrentPhase;
        public RushStage RushPhase;
        public Player OtherPlayer { get { return CurrentPlayer == Player.one ? Player.two : Player.one; } }
        public bool IsAttackerPivotRequired;
        public bool IsDefenderPivotRequired;
        public int ReplaceCount;
        public CharacterClass CurrentReplacedCharacter;
        public List<CharacterClass> RushDeathRoster;
        public List<CharacterClass> DefenderDeathRoster;
        public bool IsDefenseReplacementRequired;
        public Player CurrentRusher;

        public void StartNewAttack()
        {
            Rusher = null;
            RushTarget = null;
            IsAttackerPivotRequired = false;
            IsDefenderPivotRequired = false;
            CurrentPhase = Phases.RushSelection;
            RushPhase = RushStage.Start;
            CurrentSelection = SelectionType.Rusher;
            RushDeathRoster = null;
            DefenderDeathRoster = null;
            IsDefenseReplacementRequired = false;
            CurrentRusher = CurrentPlayer;
        }
        

    }

    public enum RushStage
    {
        Start,
        Attack,
        Defense,
        AdditionalAttackTargetRequired,
        AdditionalDefenseTargetRequired,
        OffenseReplacementRequired,
        DefenseReplacementRequired,
        Done

    }
}
